num_class=6;

for i=1:num_class
    for j=1:size(cdbk,1)
        cf(i,j)=length(find(encoded_data((i-1)*100+1:i*100,:)==j));
    end
end

norm_cf=cf;

for i=1:num_class
    norm_cf(i,:)=norm_cf(i,:)/sum(norm_cf(i,:));
end

prob=cf;
for i=1:size(cdbk,1)
    prob(:,i)=prob(:,i)/sum(prob(:,i));
end

weight = norm_cf.*prob;

